home *** CD-ROM | disk | FTP | other *** search
- ////////////////////////////////////////////////////////////////
- //
- // Activation.js
- //
- // Activation mechanisms
- //
-
- // The activation IDs are encoded using the follwing method:
- //
- // ID is a 32-bit int: 0x87654321
- //
- // nibble 8: High bit (0x80000000): Guided mode
- // rest (0x70000000): Main module: 0- Common stuff (like print preview)
- // 1- Photo, 2- Projects, 3- Albums,
- // 4- Motion, 5- Internet
- //
- // nibble 7: Toolkit in module. 1-based. 0 is default or no action
- // nibble 6: Toolkit flyout. 1-based. 0 is default or no action
- //
- // nibble 2: Bitfield corresponding to the nibbles mentionned above. If bit is set, also tell
- // LTK to physically click the button
- // nibble 1: Extra option bits: 0x1: Welcome page
- // 0x2: Skip Welcome pages unconditionally
-
- function _ALActivate( ID )
- {
- switch( ID & 0xF0000000 ) { // Get main module
- case 0x00000000: // Common Stuff
- switch( ID & 0x0F000000 ) {
- case 0x00000000: // Default module
- if( ID & 0x2 ) // Skip welcome page?
- {
- ID = ID & 0xFFFFFFFE;
- }
- else
- {
- // Should we show Welcome page?
- nShowWelcome = LTKGetIntKeyValue( "HKEY_CURRENT_USER%5CSOFTWARE%5CMGI%5CPhotoSuiteII%5C1.0%5CUserSettings", "MainWelcomePage", 1 );
- nShowWelcome = parseInt( nShowWelcome );
-
- if( isNaN( nShowWelcome ) )
- {
- nShowWelcome = 1;
- }
-
- if( nShowWelcome )
- {
- ID = ID | 0x1;
- }
- }
-
- if ( ID & 0x1 ) // Welcome page?
- {
- // Make sure Photos is selected and reg key is accurate
- ALClickButton(0);
-
- // Set up Welcome page
- RPASetTarget('../Photos/RightPaneA3.html' );
- WSetTarget('../Common/W_Welcome.html' );
- LTKTriggerEvent("file:/Resources/WorkflowsComponent!Photos!CommandBar.wkf,99,1" );
- break; // Don't go further.
- }
-
- // Get last mode
- nLastButton = LTKGetIntKeyValue( "HKEY_CURRENT_USER%5CSOFTWARE%5CMGI%5CPhotoSuiteII%5C1.0%5CUserSettings", "LastActivityListButton", 0 );
- nLastButton = parseInt( nLastButton );
-
- if( isNaN( nLastButton ) )
- {
- nLastButton = 0;
- }
-
- // Convert to activation ID
- nLastButton = (nLastButton+1) << 28;
- nLastButton = nLastButton | 0x80;
-
- _ALActivate(nLastButton);
- break;
-
- case 0x01000000: // Print Preview
- RPASetTarget("../Common/RightPaneB2.html");
- WSetTarget("../Common/W_PrintPreview.html");
- BTSetTarget("../Common/BT_PrintPreview.html");
- LTKTriggerEvent("file:/Resources/WorkflowsComponent!Common!CommandBar.wkf,99,0");
- break;
-
- case 0x02000000: // Print Photo Package
- switch( ID & 0x00F00000 ) {
- case 0x00000000: // Default action
- case 0x00100000: // Select a template
- RPASetTarget("../Common/RightPaneB2.html");
- WSetTarget("../Common/W_PrintPackage.html");
- BTSetTarget("../Common/BT_PrintPackage.html");
- BTSetVisibility( 0x01 );
- LTKTriggerEvent("file:/Resources/WorkflowsComponent!Common!CommandBar.wkf,99,1");
- break;
-
- case 0x00200000:
- RPASetTarget("../Common/RightPaneB2.html");
- WSetTarget("../Common/W_PrintPackagePreview.html");
- BTSetTarget("../Common/BT_PrintPreview.html");
- LTKTriggerEvent("file:/Resources/WorkflowsComponent!Common!CommandBar.wkf,99,0");
- break;
-
- }
- break;
-
- case 0x03000000: // Send to PhotoNet
- RPASetTarget("../Common/RightPaneA2.html");
- WSetTarget("../Common/W_SendPhotoNet.html");
- BTSetTarget("../Common/BTSendPhotoNet.html");
- LTKTriggerEvent("file:/Resources/WorkflowsComponent!Common!CommandBar.wkf,99,1");
- break;
-
- case 0x0F000000: // About pages
- showModalDialog("../Common/About.html", null, "dialogWidth:350px;dialogHeight:505px;help:no");
- break;
- }
- break;
-
- case 0x10000000: // Photo Module
- if( ID & 0x00000080 ) // Click the button?
- {
- _ALClickButton(0);
- }
-
- if ( ID & 0x1 ) // Welcome page?
- {
- // Set up Welcome page
- RPASetTarget('../Photos/RightPaneA3.html');
- WSetTarget( "../Photos/W_Welcome.html" );
- RouteCall("WorkArea", "_WSetVisibility();");
-
- break; // Don't go further.
- }
-
- if( ( ID & 0x0F000000 ) != 0x01000000 ) // Anything but Get Photos
- {
- Context = LTKGetContext( 1 );
- if( Context == -1 ) // Error, can't jump
- {
- return;
- }
-
- if( Context == 0 ) // No photo available
- {
- // Call Wecome Page
- _ALActivate( ID | 0x1 );
- LTKTriggerEvent("file:/Resources/WorkflowsComponent!Photos!T_Paint.wkf,50,1;file:/Resources/WorkflowsComponent!Photos!CommandBar.wkf,99,1");
- break;
- }
- }
-
- // Sub
- ActivatePhoto( ID );
-
- break;
-
- case 0x20000000: // Projects Module
- if( ID & 0x00000080 ) // Click the button?
- {
- _ALClickButton(1);
- }
-
- if ( ID & 0x1 ) // Welcome page?
- {
- // Set up Welcome page
- RPASetTarget('../Publish/RightPaneA3.html');
- WSetTarget( "../Publish/W_Welcome.html" );
- RouteCall("WorkArea", "_WSetVisibility();");
-
- break; // Don't go further.
- }
-
- // Sub
- ActivateProjects( ID );
- break;
-
- case 0x30000000: // Album Module
- if( ID & 0x00000080 ) // Click the button?
- {
- _ALClickButton(2);
- }
-
- Context = LTKGetContext( 4 );
- if( Context == -1 ) // Error, can't jump
- {
- return;
- }
-
- if( Context == 0 ) // No album available
- {
- // Call Wecome Page
- ID = ( ID | 0x1 );
- }
-
- if ( ID & 0x1 ) // Welcome page?
- {
- // Set up Welcome page
- RPASetTarget('../Album/RightPaneA3.html');
- WSetTarget( "../Album/W_Welcome.html" );
- RouteCall("WorkArea", "_WSetVisibility();");
-
- break; // Don't go further.
- }
-
- // Sub
- ActivateAlbums( ID );
- break;
-
- case 0x40000000: // Slide Show Module
- if( ID & 0x00000080 ) // Click the button?
- {
- _ALClickButton(3);
- }
-
- Context = LTKGetContext( 3 );
- if( Context == -1 ) // Error, can't jump
- {
- return;
- }
-
- if( Context == 0 ) // No slideshow available
- {
- // Call Wecome Page
- ID = ( ID | 0x1 );
- }
-
- if ( ID & 0x1 ) // Welcome page?
- {
- // Set up Welcome page
- RPASetTarget('../Motion/RightPaneA3.html');
- WSetTarget( "../Motion/W_Welcome.html" );
- RouteCall("WorkArea", "_WSetVisibility();");
-
- break; // Don't go further.
- }
-
- switch( ID & 0x00F00000 ) {
- case 0x00500000: // Print PhotoPackage
- _ALActivate(0x02000000);
- break;
-
- case 0x00600000: // Send to PhotoNet
- _ALActivate(0x03000000);
- break;
-
- default:
- RPASetTarget('../Motion/RightPaneA.html');
- WSetTarget('../Motion/W_Motion.html');
- BTSetTarget("../Motion/BuddyTools.html");
- RouteCall("WorkArea", "RouteCall('BuddyTools', 'LTKTriggerEvent(\"file:/Resources/WorkflowsComponent!Motion!PM_Tools.wkf,1,1138\");' )" );
- }
-
- break;
-
- case 0x50000000: // Internet Module
- if( ID & 0x00000080 ) // Click the button?
- {
- _ALClickButton(4);
- }
-
- switch( ID & 0x0F000000 ) {
- case 0x00000000: // Default behavior
- RPASetTarget('../Internet/RightPaneA3.html' );
- WSetTarget("../Internet/W_Internet.html");
- break;
-
- case 0x01000000: // Directly to browser
- RPASetTarget('../Internet/RightPaneA3.html' );
- WSetTarget("../Internet/W_Internet.html");
- break;
- }
- break;
-
- case 0x60000000: // Guides
- if( ID & 0x00000080 ) // Click the button?
- {
- _ALClickButton(5);
- }
-
- RPASetTarget("../Guides/RightPaneA3.html");
- WSetTarget("../Guides/index.html");
-
- break;
-
- default:
- // Unknown!
- alert( "Unknown Activation ID!" );
- }
- }
-
-
- ////////////////////////////////////////////////////////////////
- //
- // Sub functions
- //
-
- function ActivatePhoto( ID )
- {
- if( ID & 0x00000040 ) // Click the button?
- {
- TKClickButton((ID >> 28) & 0xF);
- }
-
- switch( ID & 0xF000000 ) {
- case 0x0000000: // Default
- _ALActivate( 0x12000040 );
- break;
-
- case 0x1000000: // Get Photo
- switch( ID & 0xF00000 ) {
- case 0x100000: // From Computer
- LTKTriggerEvent("CommandDispatcher,Active,20001");
- break;
-
- case 0x200000: // From Album
- switch( ID & 0xF0000 ) {
- case 0x00000:
- case 0x10000:
- LTKTriggerEvent("CommandDispatcher,Active,20015");
- break;
-
- case 0x20000:
- RPASetTarget("../Photos/RightPaneA2.html");
- WSetTarget("../Photos/W_GetAlbum.html");
- BTSetTarget("../Photos/BTGetAlbum.html");
- LTKTriggerEvent("file:/Resources/WorkflowsComponent!Photos!CommandBar.wkf,99,3");
- break;
- }
- break;
-
- case 0x300000: // From Camera
- switch( ID & 0xF0000 ) {
- case 0x00000:
- case 0x10000:
- RPASetTarget('../Photos/RightPaneA2.html');
- BTSetTarget('../Photos/BTGetCamera.html');
- WSetTarget('../Photos/W_GetCamera.html');
- break;
-
- case 0x20000:
- // Get currently selected camera
- sCamera = LTKGetKeyValue( "HKEY_LOCAL_MACHINE%5CSOFTWARE%5CMGI%5CPhotoSuiteII%5C1.0%5CLiquid Toolkit%5CPreferences", "CurrentCameraKey", "" );
- if(sCamera)
- {
- sFile = LTKGetKeyValue( "HKEY_LOCAL_MACHINE%5CSOFTWARE%5CMGI%5CPhotoSuiteII%5C1.0%5CLiquid Toolkit%5CInput Device Configs%5C"+sCamera, "ControlCameraPage", "" );
-
- if(sFile)
- {
- BTSetTarget("../Photos/CameraCtrl/"+sFile);
- }
- }
- break;
- }
- break;
-
- case 0x400000: // From Twain
- switch( ID & 0xF0000 ) {
- case 0x00000:
- case 0x10000:
- RPASetTarget('../Photos/RightPaneA2.html');
- BTSetTarget('../Photos/BTGetTwain.html');
- WSetTarget('../Common/W_Empty.html');
- break;
-
- case 0x20000:
- WSetTarget('../Photos/W_GetTwain.html');
- break;
- }
- break;
-
- case 0x500000: // From PhotoNet
- RPASetTarget('../Photos/RightPaneA2.html');
- BTSetTarget('../Photos/BTGetPhotoNet.html');
- WSetTarget('../Photos/W_GetPhotoNet.html');
- break;
-
- case 0x600000: // New
- LTKTriggerEvent("CommandDispatcher,Active,20020");
- break;
-
- }
- break;
-
- case 0x2000000: // Edit
- RPASetTarget('../Photos/RightPaneA.html');
- BTSetTarget('../Photos/BuddyTools.html');
- WSetTarget('../Photos/W_Paint.html');
- RouteCall("WorkArea", "RouteCall('Tools', 'BTSetPaintMode(-1);');" );
- RouteCall("WorkArea", "TClickButton(-1);" );
- break;
-
- case 0x3000000: // Size and rotate
- RPASetTarget('../Photos/RightPaneA.html');
- BTSetTarget('../Photos/BuddyTools.html');
- WSetTarget('../Photos/W_Paint.html');
- // Zoom to fit when W_Paint is loaded
- RouteCall("WorkArea", "LTKTriggerEvent('CommandDispatcher,BroadcastCommand,20063');" );
- RouteCall("WorkArea", "TClickButton(2);" );
- break;
-
- case 0x4000000: // Touchup/effects
- switch( ID & 0xF00000 ) {
- case 0x100000: // Touchups
- RPASetTarget('../Photos/RightPaneA.html');
- BTSetTarget('../Photos/BTSpecialFx.html');
- WSetTarget('../Photos/W_SpecialFx.html');
- BTSetVisibility(0x2000);
- RouteCall("WorkArea", "TClickButton(-1);" );
- break;
-
- case 0x200000: // Special Fx
- RPASetTarget('../Photos/RightPaneA.html');
- BTSetTarget('../Photos/BTSpecialFx.html');
- WSetTarget('../Photos/W_SpecialFx.html');
- BTSetVisibility(0x2020);
- RouteCall("WorkArea", "TClickButton(-1);" );
- break;
-
- case 0x300000: // Warps
- RPASetTarget("../Photos/RightPaneA.html");
- WSetTarget("../Photos/W_Warp.html");
- BTSetTarget("../Photos/BTWarp.html");
- RouteCall("WorkArea", "TClickButton(-1);" );
- break;
-
- case 0x400000: // Remove Red Eye
- RPASetTarget('../Photos/RightPaneA.html');
- BTSetTarget('../Photos/BuddyTools.html');
- WSetTarget('../Photos/W_Paint.html');
- RouteCall("WorkArea", "RouteCall('Tools', 'BTSetPaintMode(6);');" );
- RouteCall("WorkArea", "TClickButton(7);" );
- TKClickButton(0x10000001); // **Change Value to ** Show edit toolkit button again.
- break;
- }
- break;
-
- case 0x5000000: // Save and Print
- switch( ID & 0xF00000 ) {
- case 0x400000: // Print Preview
- _ALActivate( 0x01000000 );
- break;
-
- case 0x500000: // Print Photo Package
- _ALActivate( 0x02000000 );
- break;
-
- case 0x800000: // Send to PhotoNet
- _ALActivate( 0x03000000 );
- break;
-
- }
- break;
-
- default:
- alert( "Unknown Activation ID!" );
- }
- }
-
- function ActivateProjects( ID )
- {
- if( ID & 0x00000040 ) // Click the button?
- {
- TKClickButton( ((ID >> 28) & 0xF) - 1 );
- }
-
- // Note: Those IDs are a little different. The toolkit is not enumerated
- // like for other modules. Rather, it is divided in categories, independant
- // of the toolkit organization.
-
- switch( ID & 0xF000000 ) {
- case 0x0000000: // Default
- Context = LTKGetContext( 2 );
- if( Context == -1 ) // Error, can't jump
- {
- return;
- }
-
- if( Context == 0 ) // No photo available
- {
- // Call Wecome Page
- _ALActivate( ID | 0x1 );
- break;
- }
-
- RPASetTarget('../Publish/RightPaneA.html');
- BTSetTarget("../Publish/BuddyTools.html");
- WSetTarget("../Publish/W_Publish.html");
- RouteCall("WorkArea", "TClickButton(-2);" );
- LTKTriggerEvent("file:/Resources/WorkflowsComponent!Publish!T_Publish.wkf,50,1;file:/Resources/WorkflowsComponent!Publish!CommandBar.wkf,99,1");
- break;
-
- case 0x2000000: // All Templates
- RPASetTarget('../Publish/RightPaneA2.html');
- BTSetTarget("../Publish/BTGetTemplate.html");
- WSetTarget("../Publish/W_GetTemplate.html");
- LTKTriggerEvent("file:/Resources/WorkflowsComponent!Publish!CommandBar.wkf,99,2");
-
- switch( ID & 0xF00000 ) {
- case 0x100000: // Yearly Calendar
- BTSetVisibility(0x20);
- break;
- case 0x200000: // Quarterly Calendar
- BTSetVisibility(0x40);
- break;
- case 0x300000: // Monthly Calendar
- BTSetVisibility(0x30);
- break;
- default: // All other templates
- BTSetVisibility(0x10);
- break;
- }
- break;
-
- case 0x3000000: // Save and print
- switch( ID & 0xF00000 ) {
- case 0x400000: // Print Preview
- _ALActivate( 0x01000000 );
- break;
-
- case 0x500000: // Print photo package
- _ALActivate(0x02000000);
- break;
-
- case 0x800000: // Send to PhotoNet
- _ALActivate(0x03000000);
- break;
-
- }
- break;
- }
- }
-
-
- function ActivateAlbums( ID )
- {
- if( ID & 0x00000040 ) // Click the button?
- {
- TKClickButton( ((ID >> 28) & 0xF) - 1 );
- }
-
- switch( ID & 0xF000000 ) {
- case 0x0000000: // Default
- RPASetTarget("../Album/RightPaneA.html");
- WSetTarget("../Album/W_Album.html");
- BTSetTarget("../Album/BuddyTools.html");
- break;
-
- case 0x1000000: // Get/Share
- switch( ID & 0xF00000 ) {
- case 0x300000: // Print photo package
- _ALActivate(0x02000000);
- break;
-
- case 0x500000: // Send to PhotoNet
- _ALActivate(0x03000000);
- break;
- }
- break;
- }
- }